package com.sy;

import org.springframework.beans.BeansException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.stereotype.Component;

/**
 * @author zbbstart
 * @date 2021/1/27 - 11:32
 */
@SpringBootApplication

@ComponentScan(basePackages = {"com.sy.*"})

@EntityScan("com.sy.entity")

@EnableJpaRepositories("com.sy.repository")


public class Application implements ApplicationContextAware {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void setApplicationContext(ApplicationContext ac) throws BeansException {
        //查看当前实例化出来的Bean对象
        // Arrays.stream(ac.getBeanDefinitionNames()).forEach(System.out::println);
    }
}
